import {Row, Col, Switch, Tag, DatePicker, Tabs, Icon, Form, Input, TimePicker, Button} from 'antd';
import {WeaQrcode, WeaDialog, WeaBrowser, WeaNewScroll, WeaTextarea,WeaUpload} from 'ecCom';
import Collapse from "../../collapse.js"

let _this = null;
import {WeaTableNew} from 'comsMobx';

const WeaTable = WeaTableNew.WeaTable;
import {inject} from 'mobx-react';
import {toJS} from 'mobx';
import {WeaLocaleProvider} from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;

@inject('meetingDialog')
class Decision extends React.Component {
  constructor(props) {
    super(props);
    _this = this;
    this.state = {
      title: props.title ? props.title : getLabel(383345, "请输入标题"),
    }
  }

  render() {
    let {dialogStatus, comsWeaTableStore, oldSecretLevel} = this.props.meetingDialog;
    let {tabDecision, tabDecisionTable,isPro} = toJS(dialogStatus);
    const colStyle = {
      textAlign: 'center',
      marginBottom: '20px',
    }
    const colStyle2 = {
      textAlign: 'center',
      marginBottom: '20px',
      marginTop: '10px',
    }
    const colRightStyle = {
      marginBottom: '20px',
    }
    const colRightStyle2 = {
      marginBottom: '20px',
      marginTop: '10px',

    }
    const colSpanStyle = {
      wordBreak: 'break-all',
    }
    const colDivStyle = {
      borderBottom: '1px solid #EAEAEA',
      minHeight: '18px'
    }
    let tabDecisionDecision = (tabDecision && tabDecision.decision) ? tabDecision.decision.replace(/\n/g, "<br>") : ''

    return (
      <div className="preview-decision">
        <Collapse ecId={`${this && this.props && this.props.ecId || ''}_Collapse@1kswg7`}
          title={getLabel(81711, "基本信息")}
          showGroup={true}
        >
          <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@3ms3gl`} style={{paddingTop: '10px'}}>

            <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@hjm4j9`} span={6} offset={2} style={colStyle2}>
              <span style={{}}>{`${getLabel(2170, "决议概述")}：`}</span>
            </Col>
            <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@tg2co2`} span={12} offset={1} style={colRightStyle2}>
              <div style={colDivStyle}>
                <span dangerouslySetInnerHTML={{__html: tabDecisionDecision}} style={colSpanStyle}/>
              </div>
            </Col>
          </Row>
            {
              tabDecision.decisiondoc != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@c74nvu`}>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@thdcaw`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(857, "相关文档")}：`}</span>

                </Col>  
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@p1ctku`} span={12} offset={1} style={colRightStyle}>

                  <div style={colDivStyle}>
                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@v4r1ds`}
                    replaceDatas={tabDecision.decisiondoc}
                    hasAddBtn={false}
                    hasAdvanceSerach={true}
                    idSeparator=","
                    isAutoComplete={1}
                    isDetail={0}
                    isMultCheckbox={false}
                    isSingle={false}
                    linkUrl={`/spa/document/index.jsp?meetingid=${tabDecision.meetingid}&id=`}
                    pageSize={10}
                    quickSearchName=""
                    title={getLabel(22243,'文档')}
                    type="37"
                    viewAttr={1}
                    inputStyle={{ width: '500px' }}
                    completeParams={{secretLevel:oldSecretLevel}}
                    dataParams={{secretLevel:oldSecretLevel}}
                  />
                  </div>
                </Col>
              </Row>
            }
            {
              tabDecision.decisionwfids != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@p3hs8h`}>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@x4vgcz`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(1044, "相关流程")}：`}</span>

                </Col> 
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@dz0db5`} span={12} offset={1} style={colRightStyle}>
                  <div style={colDivStyle}>
                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@qv2e15`}
                    replaceDatas={tabDecision.decisionwfids}
                    hasAddBtn={false}
                    hasAdvanceSerach={true}
                    idSeparator=","
                    isAutoComplete={1}
                    isDetail={0}
                    isMultCheckbox={false}
                    isSingle={false}
                    linkUrl={`/spa/workflow/index_form.jsp#/main/workflow/req?modulResourceId=${tabDecision.meetingid}&fromModul=meeting&requestid=`}
                    pageSize={10}
                    quickSearchName=""
                    tabs={[{ isSearch: 'false', key: "1", name: `${getLabel(332,'全部')}`, selected: 'false' }, { isSearch: 'false', key: "2", name: `${getLabel(18030,'我的收藏')}`, selected: 'false' }]}
                    title={getLabel(30045,'流程')}
                    type="16"
                    viewAttr={1}
                    inputStyle={{ width: '500px' }}
                    completeParams={{secretLevel:oldSecretLevel}}
                    dataParams={{secretLevel:oldSecretLevel}}
                  />
                  </div>
                </Col>
              </Row>
            }
            {
              tabDecision.decisioncrmids != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@6oh7i5`}>

                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@bv87n8`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(783, "相关客户")}：`}</span>

                </Col> 
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@7hnktn`} span={12} offset={1} style={colRightStyle}>
                  <div style={colDivStyle}>
                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@e9mlzk`}
                    replaceDatas={tabDecision.decisioncrmids}
                    hasAddBtn={false}
                    hasAdvanceSerach={true}
                    idSeparator=","
                    isAutoComplete={1}
                    isDetail={0}
                    isMultCheckbox={false}
                    isSingle={false}
                    linkUrl={isPro?'/CRM/manage/customer/CustomerBaseView.jsp?CustomerID=':"/spa/crm/static/index.html#/main/crm/customerView?customerId="}
                    pageSize={10}
                    quickSearchName=""
                    title={getLabel(136,'客户')}
                    type="7"
                    viewAttr={1}
                    inputStyle={{ width: '500px' }}
                  />
                  </div>
                </Col>
              </Row>
            }
            {
              tabDecision.decisionprjids != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@65hrnr`}>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@w57g1z`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(782, "相关项目")}：`}</span>

                </Col>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@s487lx`} span={12} offset={1} style={colRightStyle}>
                  <div style={colDivStyle}>
                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@t81ssn`}
                    replaceDatas={tabDecision.decisionprjids}
                    hasAddBtn={false}
                    hasAdvanceSerach={true}
                    idSeparator=","
                    isAutoComplete={1}
                    isDetail={0}
                    isMultCheckbox={false}
                    isSingle={false}
                    linkUrl="/spa/prj/index.html#/main/prj/projectCard?prjid="
                    pageSize={10}
                    quickSearchName=""
                    title={getLabel(101,'项目')}
                    type="8"
                    viewAttr={1}
                    inputStyle={{ width: '500px' }}
                  />
                  </div>
                </Col>
              </Row>
            }
            {
              tabDecision.decisiontskids != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@m841v4`}>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@z9gm53`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(33414, "相关任务")}：`}</span>

                </Col>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@t5c6dq`} span={12} offset={1} style={colRightStyle}>
                  <div style={colDivStyle}>
                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@0p1c1a`}
                      replaceDatas={tabDecision.decisiontskids}
                      title={getLabel(1332,'任务')}
                      type="prjtsk"
                      isSingle={false}
                      viewAttr={1}
                      linkUrl="/spa/prj/index.html#/main/prj/taskCard?taskid="
                      inputStyle={{ width: '500px' }}
                    />

                  </div>
                </Col>
              </Row>
            }

            {
              tabDecision.decisionatchids != undefined &&
              <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@qe2emk`}>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@bma070`} span={6} offset={2} style={colStyle}>
                  <span style={{}}>{`${getLabel(22194, "相关附件")}：`}</span>

                </Col>
                <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@3mymth`} span={12} offset={1} style={colRightStyle}>
                  <div style={colDivStyle}>
                    <WeaUpload ecId={`${this && this.props && this.props.ecId || ''}_WeaUpload@sfn26o`}
                    btnSize="default"//按钮大小
                    datas={tabDecision.decisionatchids}
                    style={{ display: "inline-block", padding: "0" }}
                    viewAttr={1}
                  />
                  </div>
                </Col>
              </Row>
            }
        </Collapse>

        <Collapse ecId={`${this && this.props && this.props.ecId || ''}_Collapse@gm7ky8`}
          title={getLabel(383488, "决议任务")}
          showGroup={true}
        >
          {comsWeaTableStore[tabDecisionTable] &&
          <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@yjqe22`}
            hasOrder={true}
            needScroll={false}
            sessionkey={tabDecisionTable}
            comsWeaTableStore={comsWeaTableStore[tabDecisionTable]}
          />}
        </Collapse>

      </div>
    )
  }
}

export default Decision


